import { reqGoodsDetailInfo } from '@/api'
export default {
  state: {
    goodsDetailList: {},
  },
  mutations: {
    UPDATE_GOODSDETAILLIS(state, goodsDetailList) {
      state.goodsDetailList = goodsDetailList
    },
  },
  actions: {
    async getGoodsDetailList({ commit }, skuId) {
      let result = await reqGoodsDetailInfo(skuId)
      if (result.code == 200) {
        commit('UPDATE_GOODSDETAILLIS', result.data)
      }
      console.log(result.data)
    },
  },
  getters: {
    categoryView(state) {
      return state.goodsDetailList.categoryView || {}
    },
    skuInfo(state) {
      return state.goodsDetailList.skuInfo || {}
    },
    spuSaleAttrList(state) {
      return state.goodsDetailList.spuSaleAttrList || []
    },
  },
}
